import request from '@/utils/request'

// 数据源列表
export function db_list(data) {
  return request({
    url: '/system/report/datasource/list',
    method: 'get',
    params: data
  })
}

// 新增接口数据源
export function db_addApi(data) {
  return request({
    url: '/system/report/datasource/addApi',
    method: 'post',
    data: data
  })
}

// 新增mysql数据源
export function db_addMysql(data) {
  return request({
    url: '/system/report/datasource/addMysql',
    method: 'post',
    data: data
  })
}

//字段配置
export function getColumnsByTypeList(data) {
  return request({
    url: '/system/index/dbIndexcolumn/list',
    method: 'GET',
    params: data
  })
}

//字段配置id
export function getIndexId(data) {
  return request({
    url: '/system/index/getIndexId',
    method: 'GET',
    params: data
  })
}

// 新增ES数据源
export function db_addEs(data) {
  return request({
    url: '/system/report/datasource/addEs',
    method: 'post',
    data: data
  })
}

export function db_edit(data) {
  return request({
    url: '/system/report/datasource/edit',
    method: 'post',
    data: data
  })
}

export function editPwd(data) {
  return request({
    url: '/system/report/datasource/editPwd',
    method: 'post',
    data: data
  })
}

// 删除数据源
export function db_remove(data) {
  return request({
    url: '/system/report/datasource/remove',
    method: 'post',
    data: data
  })
}

// 测试数据源
export function db_test(data) {
  return request({
    url: '/system/report/datasource/test',
    method: 'post',
    data: data
  })
}

// 删除数据前校验
export function deleteForCheck(data) {
  return request({
    url: '/system/report/datasource/deleteCheck',
    method: 'post',
    data: data
  })
}

// 删除数据前校验
export function editForCheck(data) {
  return request({
    url: '/system/report/datasource/queryDataSet',
    method: 'get',
    params: data
  })
}
